
package org.demoiselle.sample.view;

import javax.inject.Inject;
import br.gov.frameworkdemoiselle.annotation.PreviousView;
import br.gov.frameworkdemoiselle.stereotype.ViewController;
import br.gov.frameworkdemoiselle.template.AbstractEditPageBean;
import br.gov.frameworkdemoiselle.transaction.Transactional;
import org.demoiselle.sample.business.*;
import org.demoiselle.sample.domain.*;
import javax.faces.model.*;
import org.primefaces.event.TransferEvent;
import org.primefaces.model.DualListModel;
import java.util.*;

// To remove unused imports press: Ctrl+Shift+o

@ViewController
@PreviousView("./atendimento_list.jsf")
public class AtendimentoEditMB extends AbstractEditPageBean<Atendimento, Long> {

	private static final long serialVersionUID = 1L;

	@Inject
	private AtendimentoBC atendimentoBC;
	

	public List<SelectItem> getGravidade() {
		return atendimentoBC.getGravidade();
	}
	public List<SelectItem> getEstado() {
		return atendimentoBC.getEstado();
	}
	public List<SelectItem> getGenero() {
		return atendimentoBC.getGenero();
	}
	
	@Override
	@Transactional
	public String delete() {
		this.atendimentoBC.delete(getId());
		return getPreviousView();
	}
	
	@Override
	@Transactional
	public String insert() {
		this.atendimentoBC.insert(this.getBean());
		return getPreviousView();
	}
	
	@Override
	@Transactional
	public String update() {
		this.atendimentoBC.update(this.getBean());
		return getPreviousView();
	}
	
	@Override
	protected Atendimento handleLoad(Long id) {
		return this.atendimentoBC.load(id);
	}	
}